<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
    </head>
    <body>
        <div id="app">
            <btn></btn>
        </div>
        <template id="btn">
            <!-- 一个组件里面只允许一个root element -->
            <div>
                <button @click="handleClick">{{msg}}</button>
                <ul>
                    <li>1</li>
                    <li>2</li>
                    <li>3</li>
                    <li>4</li>
                    <li>5</li>
                    <li>6</li>
                </ul>
            </div>
        </template>
        <script src="../vue.js"></script>
        <script>
            let btn = {
                template: '#btn',
                data() {
                    return {
                        msg: '按钮',
                    };
                },
                methods: {
                    handleClick() {
                        console.log('click');
                    },
                },
            };
            new Vue({
                el: '#app',
                // 局部注册的组件
                components: {
                    // btn: btn,
                    btn,
                },
            });
        </script>
    </body>
</html>
